home *** CD-ROM | disk | FTP | other *** search
/ Amiga Inside! / Amiga FD Inside (1995)(Ultramax).iso / berndspd / disktools / boottool / bbsources / passwordbb_1.0.asm < prev    next >
Encoding:
Assembly Source File  |  1994-04-26  |  5.4 KB  |  280 lines

  1.  
  2. ; Assembler: DevPac 2.14
  3.  
  4. ; use Tab 11
  5.  
  6.  
  7. *****  Password-Bootblock V1.0  *****
  8.  
  9. ; -----  Vielen Dank an Frederic Thiesse für die Interrupt-Routine
  10.  
  11. bootcode    dc.l    $444f5300
  12.     dc.l    $00000000
  13.     dc.l    $00000370
  14.  
  15.     move.l    4.w,a6
  16.     jsr    -132(a6)        ; _LVOForbid
  17.  
  18. .alloc_mem    move.l    #360+12+100+108,d0    ; BitPlane+BitMap+RastPort+CopperList
  19.     move.l    #$10002,d1
  20.     jsr    -198(a6)        ; _LVOAllocMem
  21.     tst.l    d0
  22.     beq    .dos_boot
  23.     move.l    d0,d7
  24.  
  25. .open_gfx    lea    gfx_lib(pc),a1
  26.     moveq    #33,d0
  27.     jsr    -552(a6)        ; _LVOOpenLibrary
  28.     tst.l    d0
  29.     beq    .free_mem
  30.     move.l    d0,a6
  31.  
  32.     move.l    d7,a1
  33.     adda.l    #360+12,a1
  34.     jsr    -198(a6)        ; _LVOInitRastPort
  35.  
  36.     move.l    d7,a0
  37.     adda.l    #360,a0
  38.     moveq    #1,d0
  39.     move.l    #320,d1
  40.     moveq    #9,d2
  41.     jsr    -390(a6)        ; _LVOInitBitMap
  42.  
  43.     move.l    d7,a0
  44.     adda.l    #360+12,a0        ; Strukturen verbinden
  45.     move.l    d7,a1
  46.     adda.l    #360,a1
  47.     move.l    d7,a2
  48.     move.l    a1,$04(a0)
  49.     move.l    a2,$08(a1)
  50.  
  51.     move.l    d7,a1
  52.     adda.l    #360+12,a1
  53.     moveq    #52,d0
  54.     moveq    #6,d1
  55.     jsr    -240(a6)        ; _LVOMove
  56.     move.l    d7,a1
  57.     adda.l    #360+12,a1
  58.     lea    password(pc),a0
  59.     moveq    #21,d0
  60.     jsr    -60(a6)        ; _LVOText
  61.  
  62.     moveq    #107,d0
  63.     move.l    d7,a0
  64.     adda.l    #360+12+100,a0
  65.     move.l    a0,a2
  66.     lea    coplist(pc),a1
  67. .loop    move.b    (a1)+,(a0)+
  68.     dbf    d0,.loop
  69.  
  70.     move.l    d7,d0
  71.     move.w    d0,46(a2)        ; BitPlane-Zeiger in
  72.     swap    d0        ; BPL1PTH / BPL1PTL
  73.     move.w    d0,42(a2)        ; schreiben (s.u.)
  74.  
  75.     lea    $dff000,a0
  76.     move.l    a2,$080(a0)    ; COP1LCH
  77.     move.w    #0,$088(a0)    ; COPJMP1
  78.     move.w    #$8300,$096(a0)    ; DMACON
  79.  
  80. ; -----  über Interrupt die Daten von der Tastatur einlesen
  81.  
  82.     movem.l    d0-d7/a0-a6,-(sp)
  83.     
  84.     move.w    $dff01c,d0        ; INTENAR (Interrupts aus)
  85.     ori    #$8000,d0
  86.     move.w    d0,d7
  87.     move.w    #$7fff,$dff09a    ; INTENA
  88.     
  89.     move.l    104,d6        ; orig. Vektor sichern...
  90.     lea    .get_key(pc),a0
  91.     move.l    a0,104        ; ...und eigenen eintragen
  92.     
  93.     move.w    #$c008,$dff09a    ; INTENA (Interrupts an)
  94.     move.l    key_count(pc),d1
  95.     lea    key_table(pc),a4
  96. .key_loop    btst    #0,d5        ; Wurde Taste gedrückt ?
  97.     beq.s    .key_loop
  98.     move.b    d4,d0        ; RAW-Code holen
  99.     bclr    #0,d5
  100.     move.b    (a4),d2
  101.     cmp.b    d2,d0        ; War`s die richtige Taste ?
  102.     bne.s    .key_loop        ; nö
  103.     adda.l    #1,a4        ; jau
  104.     dbra    d1,.key_loop
  105.  
  106.     move.w    #$7fff,$dff09a    ; INTENA (Interrupts aus)
  107.     move.l    d6,104        ; orig. Int-Vektor eintragen
  108.     move.w    d7,$dff09a        ; INTENA (Interrupts an)
  109.  
  110.     movem.l    (sp)+,d0-d7/a0-a6
  111.  
  112. ; -----  orig. CopperList eintragen, ordentlich beenden & Standartboot
  113.     
  114.     move.l    d7,a1
  115.     adda.l    #360+12,a1
  116.     moveq    #52,d0
  117.     moveq    #6,d1
  118.     jsr    -240(a6)        ; _LVOMove
  119.     move.l    d7,a1
  120.     adda.l    #360+12,a1
  121.     lea    ok_pw(pc),a0
  122.     moveq    #21,d0
  123.     jsr    -60(a6)        ; _LVOText
  124.  
  125.     move.l    d7,a0
  126.     adda.l    #360+12+100,a0
  127.     move.l    a0,a2
  128.     move.w    #$0040,50(a0)    ; COLOR00 (dunkelgrün)
  129.     move.w    #$00f0,54(a0)    ; COLOR01 (knallgrün)
  130.     
  131.     lea    $dff000,a0
  132.     move.l    a2,$080(a0)    ; COP1LCH
  133.     move.w    #0,$088(a0)
  134.  
  135.     move.w    #$ffff,d0
  136.     move.w    #$000a,d1
  137. .wait    nop
  138.     dbra.w    d0,.wait
  139.     dbra.w    d1,.wait
  140.  
  141.     move.l    $26(a6),$080(a0)    ; COP1LCH
  142.     move.w    #0,$088(a0)
  143.  
  144. .close_gfx    move.l    a6,a1
  145.     move.l    4.w,a6
  146.     jsr    -414(a6)        ; _LVOCloseLibrary
  147.  
  148. .free_mem    move.l    d7,a1
  149.     move.l    #360+12+100+108,d0
  150.     jsr    -210(a6)        ; _LVOFreeMem
  151.  
  152.     jsr    -138(a6)        ; _LVOPermit
  153.  
  154. ; -----  Standart DOS-Bootcode
  155.  
  156. .dos_boot    lea    exp_lib(pc),a1
  157.     moveq    #37,d0
  158.     jsr    -552(a6)        ; _LVOOpenLibrary
  159.     tst.l    d0
  160.     beq.s    .no_explib
  161.     movea.l    d0,a1
  162.     bset    #6,34(a1)
  163.     jsr    -414(a6)        ; _LVOCloseLibrary
  164. .no_explib    lea    dos_lib(pc),a1
  165.     jsr    -96(a6)        ; _LVOFindResident
  166.     tst.l    d0
  167.     beq.s    .not_found
  168.     movea.l    d0,a0
  169.     movea.l    22(a0),a0
  170.     moveq    #0,d0
  171.     rts
  172. .not_found    moveq    #-1,d0
  173.     rts
  174.  
  175. ; -----  Interrupt-Routine
  176.  
  177. .get_key    move.l    d0,-(a7)
  178.     move.w    #8,$dff09c        ; INTREQ
  179.     btst    #3,$bfed01        ; CIA-A ICR
  180.     bne.s    .get_key2
  181.     move.b    $bfec01,d0        ; CIA-A SP -> Tastencode holen
  182.     ror.b    #1,d0        ; und RAW-Code berechnen
  183.     eori.b    #$ff,d0
  184.     bmi.s    .get_key1        ; Taste losgelassen ?
  185.     btst    #0,d5        ; Schon Code gespeichert ?
  186.     bne.s    .get_key1
  187.     move.b    d0,d4        ; Code speichern
  188.     bset    #0,d5
  189. .get_key1    move.b    #$ff,$bfec01    ; CIA-A SP (Tastaturleitung auf 0)
  190.     bset    #6,$bfee01        ; CIA-A CRA
  191.     bclr    #6,$bfee01        ; CIA-A CRA
  192. .get_key2    move.b    $bfed01,d0        ; CIA-A ICR
  193.     move.l    (a7)+,d0
  194.     rte
  195.  
  196. ; ----- wenn eine falsche Taste gedrückt wurde...
  197.  
  198. .wrong_key    movem.l    (sp)+,d0-d7/a0-a6
  199.  
  200.     move.l    d7,a1
  201.     adda.l    #360+12,a1
  202.     moveq    #52,d0
  203.     moveq    #6,d1
  204.     jsr    -240(a6)        ; _LVOMove
  205.     move.l    d7,a1
  206.     adda.l    #360+12,a1
  207.     lea    wrong_pw(pc),a0
  208.     moveq    #21,d0
  209.     jsr    -60(a6)        ; _LVOText
  210.  
  211.     move.l    d7,a0
  212.     adda.l    #360+12+100,a0
  213.     move.l    a0,a2
  214.     move.w    #$0400,50(a0)    ; COLOR00 (dunkelrot)
  215.     move.w    #$0f00,54(a0)    ; COLOR01 (knallrot)
  216.     
  217.     lea    $dff000,a0
  218.     move.l    a2,$080(a0)    ; COP1LCH
  219.     move.w    #0,$088(a0)
  220.  
  221. .wait4ever    bra.s    .wait4ever
  222.  
  223. ; ----- CopperList, Variablen & Konstanten
  224.  
  225. coplist    dc.w    $2001,$fffe
  226.     dc.w    $0100        ; BPLCON0
  227.     dc.w    $0200
  228.     dc.w    $008e        ; DIWSTRT
  229.     dc.w    $0581
  230.     dc.w    $0090        ; DIWSTOP
  231.     dc.w    $40c1
  232.     dc.w    $0092        ; DDFSTRT
  233.     dc.w    $0038
  234.     dc.w    $0094        ; DDFSTOP
  235.     dc.w    $00d0
  236.     dc.w    $0102        ; BPLCON1
  237.     dc.w    $0000
  238.     dc.w    $0104        ; BPLCON2
  239.     dc.w    $0024
  240.     dc.w    $0108        ; BPL1MOD
  241.     dc.w    $0000
  242.     dc.w    $010a        ; BPL2MOD
  243.     dc.w    $0000
  244.     dc.w    $00e0        ; BPL1PTH
  245.     dc.w    0        ; wird während Boot gefüllt (s.o.)
  246.     dc.w    $00e2        ; BPL1PTL
  247.     dc.w    0        ; wird während Boot gefüllt (s.o.)
  248.     dc.w    $182        ; COLOR01
  249.     dc.w    $0fff
  250.     dc.w    $180        ; COLOR00
  251.     dc.w    $0000
  252.     dc.w    $a10f,$fffe
  253.     dc.w    $0100        ; BPLCON0
  254.     dc.w    $1200
  255.     dc.w    $a90f,$fffe
  256.     dc.w    $0100        ; BPLCON0
  257.     dc.w    $0200
  258.     dc.w    $af0f        ; Zeile
  259.     dc.w    $fffe
  260.     dc.l    $fffffffe        ; End der CopperList
  261.     
  262. coplist_end
  263.  
  264.  
  265. password    dc.b    "Enter Disk`s Password",0
  266. wrong_pw    dc.b    "Wrong. I do not boot.",0
  267. ok_pw    dc.b    "  OK. Booting now... ",0
  268.  
  269. gfx_lib    dc.b    "graphics.library",0
  270. dos_lib    dc.b    "dos.library",0
  271. exp_lib    dc.b    "expansion.library",0
  272.  
  273. key_count    dc.l    3        ; zum Test das Passwort
  274. key_table    dc.b    $26,$12,$36,$21    ; "jens"
  275.  
  276. bootcode_end
  277.  
  278.     end
  279.  
  280.